using System.IO;
using System.Text;
using Be.Timvw.Framework.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Tests.IO.StreamHelper
{
    [TestClass]
    public class WhenCopying
    {
        [TestMethod]
        public void ShouldCopyAllBytesFromInput()
        {
            byte[] expected = Encoding.ASCII.GetBytes("some input data");
            using(MemoryStream input = new MemoryStream(expected))
            {
                using(MemoryStream output = new MemoryStream())
                {
                    Be.Timvw.Framework.IO.StreamHelper.Copy(input, output, 512);

                    output.Position = 0;
                    byte[] actual = output.ToArray();

                    Assert.IsTrue(EnumerableHelper.HaveSameElements(expected, actual));
                }
            }
        }
    }
}